<%@ page import="java.util.List" %>
<%@ page import="com.guotd.ticketSystem.entity.Airport" %>
<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>机场列表</title>
    <link rel="stylesheet" href="css/list1.css">
</head>
<body>
<%
    if (session.getAttribute("airport_msg") != null)
    {
%>
<h2><%= session.getAttribute("airport_msg") %></h2>
<%
    }
%>
<a href="airport_add.jsp" class="table-button">添加机场信息</a>
<% List<Airport> airports= (List<Airport>) session.getAttribute("airports"); %>
<table>
    <tr>
        <th>名称</th>
        <th>城市</th>
        <th>地址</th>
        <th>电话</th>
        <th colspan="2">操作</th>
    </tr>
    <%
        if(airports!=null){
            for (Airport a : airports) {
    %>
    <tr>
        <td> <%=a.getName()%> </td>
        <td> <%=a.getCity()%> </td>
        <td> <%=a.getAddress()%> </td>
        <td> <%=a.getTel()%> </td>
        <td> <a href="delAirport?name=<%=a.getName()%>" class="table-button">删除</a> </td>
        <td> <a href="airport_edit.jsp?name=<%=a.getName()%>&&city=<%=a.getCity()%>&&address=<%=a.getAddress()%>&&tel=<%=a.getTel()%>" class="table-button">编辑</a> </td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>